package com.gujiangbo.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gujiangbo.dao.SchoolmateDaoService;
import com.gujiangbo.entity.Schoolmate;
import com.gujiangbo.mapper.SchoolmateMapper;
import com.gujiangbo.request.SchoolmateRequest;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: gujiangbo.co
 * @Contact: 646832012@qq.com
 * @Date: 2021/12/7 21:57
 * @Version: 1.0
 * @Description:
 */
@Repository
public class SchoolmateDaoServiceImpl extends ServiceImpl<SchoolmateMapper, Schoolmate> implements SchoolmateDaoService {
    @Override
    public void batchGenSchoolmates(List<Schoolmate> list, int bathSize) {
        this.saveBatch(list, bathSize);
    }

    @Override
    public Schoolmate getSchoolmate(SchoolmateRequest request) {
        Schoolmate queryParams = new Schoolmate();
        BeanUtils.copyProperties(request, queryParams);
        return this.baseMapper.selectOne(new QueryWrapper<Schoolmate>().setEntity(queryParams));
    }
}
